jQuery.fn.extend({
			hotImg : function(options) {
				var defaults = {
					data : [{
								img : "",
								link : ""
							}]
				};
				options = $.extend(defaults, options);
				var thisObj = this;
				var imgCount = options.data.length;
				var $hotImg = $("<div class='hot-img' />");
				var $tab = "";
				var $imgBox = "";
				var tabHtml = "<ul class='btn-box' >";
				var imgBoxHtml = "<ul class='img-box'>";
				var autoIndex = 1;

				$(options["data"]).each(function(i, imgData) {
					i++;
					if (i == 1) {
						tabHtml += "<li class='here'>" + i + "</li>";
					} else {
						tabHtml += "<li>" + i + "</li>";
					}
					imgBoxHtml += "<li><a target='_self' href='"
							+ imgData["link"] + "' ><img src='"
							+ imgData["img"] + "' /></a></li>";
				});
				tabHtml += "</ul>";
				$tab = $(tabHtml);
				$imgBox = $(imgBoxHtml);
				$hotImg.append($imgBox);
				$hotImg.append($tab);
				$(thisObj).html($hotImg);

				var moveImgBox = function(index) {
					var tempIndex = index;
					if (index == imgCount) {
						$imgBox.append("<li><a target='_self' href='"
								+ options["data"][0]["link"] + "' ><img src='"
								+ options["data"][0]["img"] + "' /></a></li>");
					} else if (index > imgCount) {
						tempIndex = 1;
					}
					autoIndex = tempIndex;
					$tab.find("li").removeClass("here");
					$tab.find("li").eq(tempIndex - 1).addClass("here");
					$imgBox.animate({
								top : (-254 * (index - 1)) + "px"
							}, {
								duration : 550,
								complete : function() {
									if (index > imgCount) {
										$imgBox.css("top", "0px").find("li")
												.eq(imgCount).remove();
									}
								}
							});

				};

				var autoTimer = "";
				var aotoRun = function() {
					autoTimer = setInterval(function() {
								autoIndex++;
								moveImgBox(autoIndex);
							}, 3500);
				};

				var timer = "";
				$tab.find("li").mouseover(function() {
							if (timer != "") {
								clearTimeout(timer);
							}
							if (autoTimer != "") {
								clearTimeout(autoTimer);
							}
							var obj = this;
							timer = setTimeout(function() {
										moveImgBox(parseInt($(obj).html()));
									}, 150);

						}).mouseout(function() {
							aotoRun();
						});

				aotoRun();

			}
		});
/**
 * ffui 所有对象均返回本身，未来考虑 两种方式兼容，1 传对象参数 2直接调用对象并使用 jQuery.dialog();版本
 */
jQuery.extend({
	ffui : {
		uiMask : function(options) {
			var o = {
				color : "#000000",
				opacity : 20
			};
			o = jQuery.extend(o, options);

			var $uiMask = $("#ffui_ui_mask");
			if ($uiMask.size() == 0) {
				$uiMask = $("<div id='ffui_ui_mask' class='ui-mask' />");
				var $body = $("body");
				$uiMask.css({

							opacity : o.opacity / 100,
							filter : "alpha(opacity=" + o.opacity + ")",
							width : "100%",
							height : "100%"

						});
				$body.append($uiMask);
			}
			return $uiMask;
		},
		uiBox : function() {

			var $uiBox = $("#ffui_ui_box");
			if ($uiBox.size() == 0) {
				$uiBox = $("<div id='ffui_ui_box' />");
				var $body = $("body");
				$body.append($uiBox);
			}
			return $uiBox;
		},
		dialog : function(options) {

			var o = {
				title : "提示",
				text : "确定吗？",
				buttons : [{
							text : "",
							event : function() {
							}
						}]
			};
			o = $.extend(o, options);
			var $dialog = $("#ffui_ui_dialog");
			if ($dialog.size() == 0) {
				var html = "";
				html = "<div id='ffui_ui_dialog' class='ui-dialog'><div class='dialog-border-top'><img src='../images/h460_t.gif'/></div>"
						+ "<div class='dialog-border-middle'>"
						+ "<table cellpadding='0' cellspacing='0' border='0'><tr>"
						+ "<td class='dialog-border-left'></td>"
						+ "<td class='dialog-center'>"
						+ "<div class='dialog-inner-box'>"
						+ "<table width='100%' cellpadding='0' cellspacing='0' border='0'>"
						+ "<tr><td class='dialog-inner-top'>"
						+ "<div class='dialog-title'><div id='ui_dialog_title' class='dialog-title-ctx'>提示</div><div class='dialog-close'><a id='ui_dialog_close' href='#'></a></div></div>"
						+ "</td></tr>"
						+ "<tr><td valign='top'><div id='ui_dialog_ctx' class='dialog-ctx'>dsadsadsadsa</div></td></tr>"
						+ "<tr><td class='dialog-inner-bottom'><div id='ui_dialog_footer' class='dialog-footer'></div></td></tr></table>"
						+ "</div></td>"
						+ "<td class='dialog-border-right'></td></tr></table></div>"
						+ "<div class='dialog-border-bottom'><img src='../images/h460_b.gif'/></div></div>";
				$dialog = $(html);
				$.ffui.uiBox().append($dialog);
				$dialog.find("#ui_dialog_close").click(function() {
							closeDialog();
						});
			}

			var closeDialog = function() {
				$dialog.css("display", "none");
				$.ffui.uiMask().css("display", "none");
			};

			$dialog.find("#ui_dialog_title").html(o.title.toString());
			$dialog.find("#ui_dialog_ctx").html(o.text.toString());

			var $footer = $dialog.find("#ui_dialog_footer");
			var $button = "";
			$footer.empty();
			$(o.buttons).each(function(i, button) {
				$button = $("<span class='dialog-btn'><input type='button' value='"
						+ button["text"] + "' /></button></span>");
				$button.click(function(e) {
							button.event(e);
							closeDialog();
						});
				$footer.append($button);
			});

			$.ffui.uiMask().css("display", "block");
			$dialog.css({
						top : "20%",
						left : Math.floor(($(window).width() - $dialog.width())
								/ 2)
								+ "px",
						display : "block"
					});

		}
	}
});